package com.ruoyi.syrw.common;


import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class GaussianFunction {

    public GaussianFunction(double a, double b) {
        this.a = Double.isNaN(a) ? 0 : a;
        this.b = Double.isNaN(b) ? 0 : b;
    }

    private double a;
    private double b;


    public double value(double x, double... parameters) {
        double a = parameters[0];
        double b = parameters[1];
        return a * Math.pow(Math.E, (b * x));
    }

    public double getY(double x) {
        return value(x, a, b);
    }

    public double getX(double y) {
        return b * Math.log(y / a);
    }

}
